import request from '@/config/axios'
import type { Dayjs } from 'dayjs';

/** 课程签到记录信息 */
export interface ScanRecord {
          id: number; // 刷码记录主键ID
          studentId: number; // 学生ID
          classesId: number; // 班级ID
          deviceId: number; // 设备ID
          deviceSn: string; // 设备标识
          venueId: number; // 关联场地ID
          scanType: number; // 刷码类型（0进，1出）
  }

// 课程签到记录 API
export const ScanRecordApi = {
  // 查询课程签到记录分页
  getScanRecordPage: async (params: any) => {
    return await request.get({ url: `/train/scan-record/page`, params })
  },

  // 查询课程签到记录详情
  getScanRecord: async (id: number) => {
    return await request.get({ url: `/train/scan-record/get?id=` + id })
  },

  // 新增课程签到记录
  createScanRecord: async (data: ScanRecord) => {
    return await request.post({ url: `/train/scan-record/create`, data })
  },

  // 修改课程签到记录
  updateScanRecord: async (data: ScanRecord) => {
    return await request.put({ url: `/train/scan-record/update`, data })
  },

  // 删除课程签到记录
  deleteScanRecord: async (id: number) => {
    return await request.delete({ url: `/train/scan-record/delete?id=` + id })
  },

  /** 批量删除课程签到记录 */
  deleteScanRecordList: async (ids: number[]) => {
    return await request.delete({ url: `/train/scan-record/delete-list?ids=${ids.join(',')}` })
  },

  // 导出课程签到记录 Excel
  exportScanRecord: async (params) => {
    return await request.download({ url: `/train/scan-record/export-excel`, params })
  }
}
